package com.cdream.basic.algorithm.datastructure;


import java.util.PriorityQueue;

/**
 * @author cdream
 * @date 7/31/21
 */
public class PriorityQueueExample {
    public static void main(String[] args) {
        PriorityQueue<Integer> queue = new PriorityQueue<Integer>(5,(a,b)->a-b);
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        queue.offer(5);
        queue.offer(12);
        queue.offer(14);
        queue.offer(19);
        queue.offer(11);
        while (!queue.isEmpty()){
            System.out.println(queue.poll());
        }
    }
}
